package com.pcbly.web.persistence.log;

import com.pcbly.web.bean.system.LogBean;
import com.pcbly.web.components.hibernate.support.Page;
import com.pcbly.web.components.utils.random.GUID;
import com.pcbly.web.persistence.HibernateBaseDao;

public class LoggerHibernateDao extends HibernateBaseDao<LogBean> implements
		LoggerDao {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7946629184811843594L;

	public LoggerHibernateDao() {
		super();
	}

	protected Class<LogBean> getEntityClass() {
		return LogBean.class;
	}

	@Override
	public Page<LogBean> getPageLogBeans(LogBean bean) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void saveLogger(LogBean bean) throws Exception {
		// TODO Auto-generated method stub
		if(logger.isDebugEnabled()){
			logger.debug("save logger ........ ");
		}
		try {
			String id = (new GUID()).toString();
			bean.setId(id);
			getHibernateTemplate().save(bean);
//			getHibernateTemplate().clear();
		} catch (Exception e) {
			e.printStackTrace();
			logger.error(e.getMessage());
		}
	}
}
